package main

import (
	"fmt"

	"math/rand"

	"time"
)


//func useBufio(){
//	reader := bufio.NewReader(stuname)
//	reader.ReadSlice()
//
//}

//func writerFile(content,fileName string){
//	create, err :=os.Create(filename)
//	if err != nil {
//		panic(err)
//	}
//	defer create.Close()
//	bufio.NewWriter(create)
//	fmt.Fprint(writer,content)
//	writer.Flush()
//
//}
//

//count :=strings.Count(,)
//fmt.Println("出现的次数是",count)
//
//func writerFile(stuname string,path string)  {
//	fi, err :=os.OpenFile(path,os.O_CREATE,0664)
//	if err != nil{
//		fmt.Println(err)
//		return
//	}
//	defer fi.Close()
//	_,err =fi.WriteString(stuname)
//	if err != nil{
//		return
//	}
//
//
//}

//name := string(stuname)
//			path := "stuname.txt"
//			WriterFile(name,path)

func main(){
	var str1 string
	fmt.Println("按任意键输出一名同学名字：")

	rand.Seed(time.Now().UnixNano())    //不加随机种子默认就是1

	for {
		fmt.Scanln(&str1)
		if str1 == "q" || str1 == "" {
			fmt.Println("点名系统已经退出")
			break
		}

		if str1 != "q"  || str1 != ""{
			stuname :=[]string{"史伟明","易鸽玲","项鼎","严冬豪","zz","ssy","HMJ"}

			if i :=0;i<len(stuname){
				i = rand.Intn(len(stuname))
				if i == 0 {
					fmt.Println("请史伟名回答问题")



				}else if i == 1{
					fmt.Println("请易鸽玲回答问题")

				}else if i == 2{
					fmt.Println("请项鼎回答问题")

				}else if i == 3{
					fmt.Println("请严冬豪回答问题")

				}else if i == 4{
					fmt.Println("请zz回答问题")

				}else if i == 5{
					fmt.Println("请ssy回答问题")

				}else if i == 6{
					fmt.Println("请HMJ回答问题")

				}

				stuname = append(stuname[:i],stuname[i+1:]...)

			}
		}





	}

}



